package com.heima.media.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Component;

import java.util.concurrent.Future;


@Slf4j
@Component
public class B {

    @Async("leadnewsExecutor")
    public Future<Long> b(){ //异步返回类型写Future<T>
      log.info("执行B业务");
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return new AsyncResult<>(1L); //异步带返回值  被调方B返回给调方A 返回值
    }
}
